%%%-------------------------------------------------------------------
%%% @author kk
%%% @copyright (C) 2024, <COMPANY>
%%% @doc
%%%
%%% @end
%%% Created : 18. 7月 2024 19:42
%%%-------------------------------------------------------------------
-module(d2_2).
-author("kk").

%% API
-export([start/0]).

start() ->
  Nums = {1, 2, 3},
  Sum = getSum(tuple_to_list(Nums)),
  io:fwrite("~w", [Sum]).

getSum([]) -> 0;
getSum(X) -> getSum(X, 0).
getSum([H | T], Count) ->
  Sum = Count + H,
  case T of
     [] -> Sum;
     _  -> getSum(T, Sum)
end.